/**
 * Created by bian on 16-11-14.
 */
// base
require("../../both/base.js");


// css


import React from 'react';
// import AMUIReact from 'amazeui-react';
// import SliderData from '../../../../../mock/userSlider';
const Slider = AMUIReact.Slider;

// js
class UserSliderItem extends Slider.Item {
    constructor(props) {
        super(props)
    }


    convertClassName () {
        let arg = [].slice.call(arguments);
        let result = '';
        arg.forEach(function (item) {
            if (!item) {
                return;
            }
            let type = typeof item;
            if (type === 'number' && type === 'string') {
                result += ' ' + item;
            } else if (Array.isArray(item)) {
                result += ' ' + this.convertClassName(item);
            } else if (type === 'object') {
                for (let key in item) {
                    if (item.hasOwnProperty(key) && item[key]) {
                        result += ' ' + key;
                    }
                }
            }
        });
        return result.trim();
    }

    render() {
        let classSet = {
            active: this.props.active && !this.props.animateIn || this.props.animateOut,
            next: this.props.active && this.props.animateIn && this.props.direction === 'next',
            prev: this.props.active && this.props.animateIn && this.props.direction === 'prev'
        };

        if (this.state.direction && (this.props.animateIn || this.props.animateOut)) {
            classSet[this.state.direction] = true;
        }

        return React.createElement(
            'li',
            {
                className: this.convertClassName(this.props.className, classSet)
            },
            this.props.children
        );
    }
}



export default UserSliderItem;